﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class HomeController : MonoBehaviour
{
    public float mMoveSpeed = 100;

    private RectTransform mRectTransform { get; set; }
    private float mTargetX { get; set; }


    private void Start()
    {
        mRectTransform = this.GetComponent<RectTransform>();
        mTargetX = -216.25f;
    }

    private void Update()
    {
        if (mRectTransform.anchoredPosition.x != mTargetX)
        {
            mRectTransform.anchoredPosition = new Vector2(Mathf.Lerp(mRectTransform.anchoredPosition.x, mTargetX, Time.deltaTime * mMoveSpeed), mRectTransform.anchoredPosition.y);
            if (Mathf.Abs(mRectTransform.anchoredPosition.x - mTargetX) <= 1f)
            {
                mRectTransform.anchoredPosition = new Vector2(mTargetX, mRectTransform.anchoredPosition.y);
                mTargetX = 115f;
            }
        }
    }
}